<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script type="text/javascript">
    $(document).ready(function() {
        var loading = '-';
        
        function loadPage() {
            Page.postJSON({
                json: { cmd: RequestCmd.DEVICE_VERSION_INFO },
                success: function(datas) {
                    var names = [], names_lte = [],names_run = [];
                    var device = DOC.device;
                    names.push(device.model); 
                    names.push(device.softwarVersion);
                    names.push(device.hardwareVersion);
                    names.push(device.configVersion);
					names_run.push(DOC.lbl.runtime);
                    names_run.push(DOC.lbl.loadAvg);
                    names_run.push(DOC.lbl.memoryTotal);
                    names_run.push(DOC.lbl.memoryFree);
                    names_run.push(DOC.lbl.memoryCache);

					if(Page.Level == 1){
						names.push(device.inlinesoftVersion);
						names.push(device.gitBranch);
						names.push(device.gitCommit);
						names.push(device.buildTime);
                    //   names.push(device.deviceId);
                    }


                    names_lte.push(device.modemVersion);
					
					if(Page.Level == 1){
						names_lte.push(device.modsoftversion);
						names_lte.push(device.modhardwareversion);
					}
					
                    names_lte.push(device.imei);
                    names_lte.push(device.imsi);
                    names_lte.push(device.iccid);
                    names_lte.push(device.sn);

                    //names_lte.push(device.lanMac);
                    Page.isNULLToSpace = true;
                    var data2 = datas.data;
                    var data_system = data2.system;
                    var values = [], values_lte = [],values_run = [];

                    values.push(data2.version.type || loading);
                   
                    values.push(data2.softVersion.software_version || loading);
                    values.push(data2.version.hwversion || loading);
                    values.push( data2.softVersion.config_version || loading);
					if(Page.Level == 1){
						values.push(data2.version.inline_soft_version || loading);
						values.push(data2.version.branch || loading);
						values.push(data2.version.sha1 || loading);
						values.push(data2.version.build || loading);
					}

                    values_lte.push(data2.modem.type || loading);
					if(Page.Level == 1){
						values_lte.push(data2.modem.softver || loading);
						values_lte.push(data2.modem.hardware || loading);
					}
                    values_lte.push(data2.factory.imei || loading);
                    values_lte.push(data2.sim.imsi || loading);
                    values_lte.push(data2.sim.iccid || loading);
					var sn = loading;
                    if(data2.softVersion.device_sn != undefined){
                        sn = data2.softVersion.device_sn
                    }
                    else if(data2.version.type && data2.factory.imei){
                        sn = data2.version.type + data2.factory.imei
                    }
					values_lte.push(sn);

                    var runtime = ConvertUtil.timeStamp(data_system.runtime || 0);
                    values_run.push(runtime);
                    values_run.push((data_system.cpu_average1 || loading) + ", " + (data_system.cpu_average5 || loading) + ", " + (data_system.cpu_average15 || loading));
                    values_run.push(data_system.mem_total ? FormatUtil.formatField(data_system.mem_total, 'KB') : loading);
                    values_run.push(data_system.mem_free ? FormatUtil.formatField(data_system.mem_free, 'KB') : loading);
                    values_run.push(data_system.mem_cache ? FormatUtil.formatField(data_system.mem_cache, 'KB') : loading);


                    var sys_html = Page.createTable(DOC.title.device, names, values, names.length, 2).replace("<td>", "<td style=\"width:32%;\">");
                    var lte_html = Page.createTable(DOC.title.lte, names_lte, values_lte, names_lte.length, 1);
                    var run_html = Page.createTable(DOC.title.run, names_run, values_run, names_run.length, 2).replace("<td>", "<td style=\"width:32%;\">");

                     $('#run_info').html(run_html);
                    $('#sys_info').html(sys_html);
                    $('#lte_info').html(lte_html);
                    Page.setStripeTable();
                    Page.isNULLToSpace = false;
                }
            });
        }

        loadPage();
    });
</script>

<div class="detail_box">
    <div id="run_info"></div>
    <div id="sys_info"></div>
    <div id="lte_info"></div>
</div>